/*@license_header@*/
package io.ticup.rad.dbs.config;

import com.alibaba.druid.pool.DruidDataSource;
import io.ticup.rad.core.pojo.druid.DruidProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

/**
 * 单数据源的配置，如需开启单数据源，加上@Configuration注解
 *
 * @author xuyuxiang
 * @date 2020/8/24
 */
@Import(DataSourcePropertiesConfig.class)
public class SingleDataSourceConfig {

    /**
     * druid数据库连接池
     *
     * @author xuyuxiang
     * @date 2020/8/25
     */
    @Bean(initMethod = "init")
    public DruidDataSource dataSource(DruidProperties druidProperties) {
        DruidDataSource dataSource = new DruidDataSource();
        druidProperties.config(dataSource);
        return dataSource;
    }

}
